import React, {PropsWithChildren} from "react"
import employeeAuthorizationStore from "../store/EmployeeAuthorizationStore";
import {Navigate} from "react-router";
import {observer} from "mobx-react-lite";

export interface RequireAuthorizationProps {

}

const RequireAuthorization: React.FC<PropsWithChildren<RequireAuthorizationProps>> = ({children}) => {
    if (!employeeAuthorizationStore.hasLogIn){
        return <Navigate to={"/logIn"}/>
    }

    return <>{children}</>
}

export default observer(RequireAuthorization)
